cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

project(rtsp2ws)

set(CMAKE_EXE_LINKER_FLAGS "-pthread -lrt -ldl")
set (CMAKE_CXX_STANDARD 11)
# SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -std=c++0x -fsanitize=address -fno-omit-frame-pointer")
# SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fsanitize=address -fno-omit-frame-pointer")
# SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")

include_directories("src")
include_directories("src/wsserver")
include_directories("src/rtspclient")
include_directories("src/fmp4_muxer")
# include_directories("3rdparty/")
add_subdirectory("src/rtspclient")
add_subdirectory("src/fmp4_muxer")


#主程序
ADD_EXECUTABLE(rtsp2ws src/main.cc src/rtsp2ws_server.cc)
TARGET_LINK_LIBRARIES(rtsp2ws rtspclient fmp4)

# ADD_EXECUTABLE(test-rtp test/test-rtp.cc)
# TARGET_LINK_LIBRARIES(test-rtp rtspclient)

# ADD_EXECUTABLE(test-regex test/test-regex.cc)
# TARGET_LINK_LIBRARIES(test-regex )

# #自动单元测试
# if (test)

#   # This adds another subdirectory, which has 'project(gtest)'.
#   add_subdirectory(3rdparty/gtest-1.6.0)

#   enable_testing()

#   # Include the gtest library. gtest_SOURCE_DIR is available due to
#   # 'project(gtest)' above.
#   include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})

#   ##############
#   # Unit Tests
#   ##############
#   add_executable(test-parseuri test/test-parseuri.cc)
#   target_link_libraries(test-parseuri gtest gtest_main rtspclient)
#   add_test(NAME Parse-rtsp-url-test COMMAND test-parseuri)

#   add_executable(test-anssdp test/test-anssdp.cc)
#   target_link_libraries(test-anssdp gtest gtest_main rtspclient)
#   add_test(NAME analyse-sdp-msg-test COMMAND test-anssdp)

#   add_executable(test-getsession test/test-getsessioninfo.cc)
#   target_link_libraries(test-getsession gtest gtest_main rtspclient)
#   add_test(NAME get-session-msg-test COMMAND test-getsession)

#   # add_executable(runServerTests test/test-server.cc)
#   # target_link_libraries(runServerTests gtest gtest_main net md5)
#   # add_test(NAME make-testServer COMMAND runServerTests)

# endif()